// Run the script in your bash
// while true; do { echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c < status.http)\r\n\r\n"; cat status.http; } | ncat -l -p 8080 ; done

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
    char string [256];
    char command [256];
    pid_t pID;
   
    system("echo '<head><META HTTP-EQUIV=\"refresh\" CONTENT=\"15\"><html><body><img src=\"http://www.zerodayclothing.com/products/designs/johntheripper1_design.png\" height=\"100\" width=\"100\" /><h1>John the Ripper: Status Report</h1>' > status.http; echo '<a href=\"http://www.whatsmyip.us\"><img border=\"0\" alt=\"my ip\" src=\"http://www.whatsmyip.us/ipimg.php\"></a><br /><br />' >> status.http");
   for(;;)
   { 
    gets(string);

    if ( strcmp("quit", string) == 0 )
	   exit(17);
    else 
    {
	 printf("Got range: %s\n", string);

         sprintf(command, "echo %s > state", string);
         system(command);
	 
	 system("date >> status.http; echo '<br />' >> status.http; echo Got Range: >> status.http; echo '<br />' >> status.http; cat state >> status.http; echo '<br />' >> status.http;");	 
         system("./prng | john --stdin pass.txt | head >> status.http; echo '<br />' >> status.http; ./john --show pass.txt >> status.http; echo '<br /><br />' >> status.http");
    }
   }
   return 0;
}
